-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: promisify debugger.sendCommand() #16861
Conversation
236e700
to
a4e1ba5
Compare
a4e1ba5
to
a5fd283
Compare
Release Notes Persisted
|
/trop run backport-to 5-0-x |
The backport process for this PR has been manually initiated, |
I have automatically backported this PR to "5-0-x", please check out #16931 |
w.webContents.debugger.attach() | ||
|
||
w.webContents.openDevTools() | ||
await emittedOnce(w.webContents, 'devtools-opened') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 FLAKE ALERT 🚨
you need to call emittedOnce
before you call openDevTools
. As written this is a race condition and will result in a flaky test.
if (e) { reject(e) } else { resolve(r) } | ||
}) | ||
}) | ||
const sendCommand = (...args) => w.webContents.debugger.sendCommand(...args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably just call w.webContents.debugger.sendCommand
directly, or if that's too verbose then const {debugger} = w.webContents; debugger.sendCommand(...)
Description of Change
This PR promisifies
debugger.sendCommand()
/cc @codebytere
Checklist
npm test
passesRelease Notes
Notes: Converted
debugger.sendCommand()
to return a Promise instead of taking a callback.